﻿using Sys.Core.Models.Dto;
using Sys.Core.Models.Queries;
using Sys.Core.Models.VO;
using MiniFox.Components;
using MiniFox.Infrastructure;

namespace Sys.Core
{
    /// <summary>
    /// 
    /// </summary>
    [AutoRegister]
    public interface IOrgProvider
    {
        #region organization
        /// <summary>
        /// 
        /// </summary>
        /// <param name="orgId"></param>
        /// <returns></returns>
        OrganizationVo GetOrganization(string orgId);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="organization"></param>
        /// <returns></returns>
        bool CreateOrganization(OrganizationDto organization);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="organization"></param>
        /// <returns></returns>
        bool UpdateOrganization(OrganizationDto organization);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="organizations"></param>
        /// <returns></returns>
        bool DeleteOrganization(params string[] organizations);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        ResultObject<IEnumerable<OrganizationVo>> Query(PagedQueryObject<OrgQuery> request);


        #endregion

        #region dept
        /// <summary>
        /// 按org 获取部门树
        /// </summary>
        /// <param name="orgId"></param>
        /// <returns></returns>
        IEnumerable<DeptVo> GetDepts(string orgId);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="deptId"></param>
        /// <returns></returns>
        DeptVo GetDept(string orgId, string deptId);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="deptPath"></param>
        /// <returns></returns>
        DeptVo GetDept(string deptPath);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="deptId"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        ResultObject<IEnumerable<UserVo>> GetUsers(string orgId, string deptId, PagedQueryObject<UserQuery> query);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="deptId"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        ResultObject<IEnumerable<UserVo>> ExclusionUsers(string orgId, string deptId, PagedQueryObject<UserQuery> query);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="deptPath"></param>
        /// <returns></returns>
        bool DeptExists(string deptPath);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dept"></param>
        /// <returns></returns>
        bool CreateDept(DeptDto dept);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dept"></param>
        /// <returns></returns>
        bool UpdateDept(DeptDto dept);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="deptPath"></param>
        /// <returns></returns>
        bool DeleteDept(string deptPath);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="deptId"></param>
        /// <returns></returns>
        bool DeleteDept(string orgId, string deptId);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="deptPath"></param>
        /// <param name="users"></param>
        bool RemoveDeptUsers(string deptPath, string[] users);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="deptPath"></param>
        /// <param name="users"></param>
        bool AddDeptUsers(string deptPath, string[] users);
        #endregion
    }
}
